﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using System.Text;
namespace JTicket.UI
{ 
    public partial class S_SaleReport : System.Web.UI.Page
    {
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            JTicket.Config.DBConfig.CryLogin(
                Server.MapPath("Report\\OperReport1.rpt"), this.CrystalReportSource1);
            if (!IsPostBack)
            {
                StringBuilder sb = new StringBuilder();
                string Bdate = Request.QueryString["Bdate"].ToString();
                string Edate = Request.QueryString["Edate"].ToString();
                string Stitlecode = Request.QueryString["StitleCode"].ToString();
                string[] scarr = Stitlecode.Split(',');
                if (scarr.Length > 0)
                {
                    for (int i = 0; i <= scarr.Length - 1; i++)
                    {
                        sb.Append("'" + scarr[i] + "',");
                    }
                }
                string Opercode = bllOper.Oper().OperCode;
                ParameterFields parameterFields = CrystalReportViewer1.ParameterFieldInfo;
                JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                    (parameterFields, Bdate, "@Bdate");
                ParameterFields parameterFields1 = CrystalReportViewer1.ParameterFieldInfo;
                JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                    (parameterFields1, Edate, "@Edate");
                ParameterFields parameterFields2 = CrystalReportViewer1.ParameterFieldInfo;
                JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                    (parameterFields2, Opercode, "@OperCode");
                ParameterFields parameterFields3 = CrystalReportViewer1.ParameterFieldInfo;
                JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                    (parameterFields3, sb.ToString().TrimEnd(','), "@StitleCode");
                this.CrystalReportSource1.DataBind();
            }
        }
    }
}